<?php
//require '/../app/controllers/CateController.php';
$app->get('/cate', 'CateController:index');
$app->get('/te', 'TeController:index');
$app->get('/test', 'TestController:index');

$app->get('/', function ($request, $response, $args) {
	$a = $this->db->table('hello');
	$data = array('user_name'=>'赵六','age'=>12,'sex'=>'女');
	$b = $a->insert($data);
   	print_r($b);
});

$app->get('/view/{name}', function ($request, $response, $args) {
	// $arr = array('name1'=>'zhangsan','name2'=>'lisi','name3'=>'wangwu');
	// $arr = $this->db->table('hello')->get();
	// print_r($arr[0]);exit;
	 return $this->view->render($response, 'profile.html');
	})->setName('profile');


$app->get('/home/model/{model_id}', 'HomeController:home');
$app->get('/home1/model/{model_id}', 'HomeController:home1');

$app->post('/home/result', 'HomeController:result');
$app->get('/home/result', 'HomeController:result');

$app->get('/home/getcate', 'HomeController:getCate');


$app->get('/json', function ($request, $response, $args) {
	$arr = $this->db->table('hello')->get();
	$arr['rows'] = $arr;
	// $data = array('name' => 'Bob', 'age' => 40);
	return $response->withJson($arr);
});

$app->get('/publish', function ($request, $response, $args) {
	 return $this->view->render($response, 'publish.html');
	});

$app->get('/publish/xml', 'PublishController:readXml');
$app->get('/publish/write', 'ItemController:writeXml');
$app->get('/publish/test', 'TmallController:test');

$app->post('/publish','IndexController:index');

$app->get('/rang100',function ($request, $response, $args) {
	 return $this->view->render($response, 'rang100.html');
	});
// $app->get('/index', function ($request, $response, $args) {
// 	 return $this->view->render($response, 'index.html');
// 	})->setName('index');
